# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>

_pyname=json-stream
pkgname=python-${_pyname}
pkgver=2.3.2
pkgrel=2
pkgdesc='Simple streaming JSON parser'
arch=(any)
url="https://github.com/daggaz/json-stream"
license=('MIT')
depends=(python python-json-stream-rs-tokenizer)
makedepends=(python-build python-installer python-setuptools python-wheel)
source=("https://files.pythonhosted.org/packages/source/${_pyname::1}/${_pyname}/${_pyname}-${pkgver}.tar.gz")
b2sums=('749a68681349883b32b217a0a9a37a122292f73da9d8795df5191300f52695c320a21b452719a6eedecfa0c48065b8e27a45f66312a310d4947409906ede6c78')

build() {
  cd "${_pyname}-${pkgver}"
  python -m build --wheel --no-isolation
}

check() {
  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd ${_pyname}-${pkgver}
  python -m installer --destdir=test_dir dist/*.whl

  PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH" python -c 'import json_stream'
}

package() {
  cd "${_pyname}-${pkgver}"
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
